Apparatus and Methods for Fast and Secure Storage of Data

ABSTRACT

A data storage apparatus includes a cache memory module and a NAND flash memory module including a cache memory mirror and a user data storage zone. The cache memory module is connected to the cache memory mirror via a path and electrically connected to the user data storage zone via another path. The cache memory module receives a write command that includes user data from a host, writes a copy of the user data into the user data storage zone in a write-back mode, and writes another copy of the user data cache memory mirror in a write-through mode. If some of the user data are lost from the cache memory module before they are written into the user data storage zone, the user data written in the cache memory mirror are copied and written into the cache memory module when the data storage apparatus is initiated again.

BACKGROUND OF INVENTION 1. Field of Invention

The present invention relates to a data-storing apparatus and, moreparticularly, to a fast and secure data storage apparatus that uses awrite-back mode and a write-through mode in a NAND flash memory.

2. Related Prior Art

A write-through mode is necessary in some cases. However, thewrite-through mode is slow in comparison with a write-back mode. Yet, incomparison with the write-back mode, the write-through mode entails lowphysical space utilization because the amount of bytes of a dirty buffercould be smaller than that of a page.

A typical solid-state drive (“SSD”) includes a NAND flash memory and acache memory. The solid-state drive often uses a write-back mode. Thatis, data are written into the cache memory, and flushed into the NANDflash memory from the cache memory when the amount of data in the cachememory reaches an integral multiple of that of a page. However, the datawill be lost if power failure occurs during the flushing of the datainto the NAND flash memory from the cache memory. In some cases, suchloss of data is intolerable, and a write-through mode must be usedinstead of the write-back mode in these cases. That is, data is flushedinto the NAND flash memory for every write command.

As mentionedabove, data is flushed into the NAND flash memory for everywrite command in the write-through mode. However, the write-through modeachieves security at the expense of performance (speed, in particular)and physical space utilization. The throughput of the solid-state driveis low because it takes the time needed for programming a page toprogram data less than a page. The write-amplification factor (“WAF”) ishigh because dummy data are often written into pages of the NAND flashas required in the write-through mode. The total bytes written (“TBW”)is reduced considerably.

The present invention is therefore intended to obviate or at leastalleviate the problems encountered in prior art.

SUMMARY OF INVENTION

It is the primary objective of the present invention to provide a fastand secure data storage apparatus.

To achieve the foregoing objective, the data storage apparatus includesa cache memory module and a NAND flash memory module including a cachememory mirror and a user data storage zone. The cache memory module isconnected to the cache memory mirror via a path and electricallyconnected to the user data storage zone via another path. The cachememory module receives a write command that includes user data from ahost, writes a copy of the user data into the user data storage zone ina write-back mode, and writes another copy of the user data to the cachememory mirror in a write-through mode. If some of the user data are lostfrom the cache memory module before they are written into the user datastorage zone, the user data written in the cache memory mirror arecopied and written into the cache memory module when the data storageapparatus is initiated again.

Other objectives, advantages and features of the present invention willbe apparent from the following description referring to the attacheddrawings.

BRIEF DESCRIPTION OF DRAWINGS

The present invention will be described via detailed illustration of thepreferred embodiment referring to the drawings wherein:

FIG. 1 is a block diagram of a fast and secure data storage apparatusaccording to the preferred embodiment of the present invention;

FIG. 2 is a flow chart of a portion of a method for operating the fastand secure data storage apparatus shown in FIG. 1; and

FIG. 3 is a flow chart of another portion of the method shown in FIG. 2.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENT

Referring to FIG. 1, a host 10 is electrically connected to a datastorage apparatus 12. Data storage apparatus 12 is a solid-state drivethat includes a cache memory module 14, a flash translation layer 16 anda NAND flash memory module 18 according to the preferred embodiment ofthe present invention.

Cache memory module 14 includes at least one cache memory 20 and othercomponents that are not shown.

NAND flash memory module 18 includes a cache memory mirror 22 and a userdata storage zone 24. In specific, NAND flash memory module 18 isconfigured to include a cache memory mirror 22 and a user data storagezone 24. Cache memory mirror 22 is programmed to operate in an SLC mode,thereby rendering the operation thereof fast. The space for storage ofdata in cache memory mirror 22 is not big, thereby rendering datastorage apparatus 12 inexpensive. User data storage zone 24 isprogrammed to operate in a MLC (preferably TLC) mode that isinexpensive.

Cache memory module 14 is electrically connected to cache memory mirror22 via a first path. Cache memory module 14 is electrically connected touser data storage zone 24 via a second path. In specific, cache memory20 of cache memory module 14 is electrically connected to user datastorage zone 24 via flash translation layer 16 in the second path.

In operation, host 10 sends a write command that includes user data tocache memory module 14 of data storage apparatus 12. Cache memory module14 writes a copy of the user data into cache memory 20, and writesanother copy of the user data into cache memory mirror 22. The twocopies of the user data are written in a same sequence. The user dataare written into cache memory mirror 22 from cache memory module 14 in awrite-through mode. The user data are written into user data storagezone 24 from cache memory 20 via flash translation layer 16 in awrite-back mode. The user data are stored in cache memory 20temporarily. The user data are flushed into user data storage zone 24from cache memory 20 via flash translation layer 16 when the amount ofthe user data stored in cache memory 20 reaches an integral multiple ofthe page size of NAND flash memory module 18. If power failure occursbefore all of the user data are transferred to user data storage zone 24from cache memory 20, the user data stored in cache memory mirror 22 arecopied and transferred to cache memory 20 when data storage apparatus 12is initiated again. Then, data storage apparatus 12 repeats theabove-mentioned process. Hence, the operation of data storage apparatus12 is fast and secure. The operation of data storage apparatus 12 isfast because the user data are written into user data storage zone 24from cache memory 20 via flash translation layer 16 in the write-backmode. The operation of data storage apparatus 12 is secure because acopy of the user data is stored in cache memory mirror 22 temporarily,and can be written into cache memory 20, if necessary, to restore thenormal operation, without having to lose any of the user data.

Referring to FIGS. 2 and 3, a method for operating data storageapparatus 12 according to the preferred embodiment of the presentinvention will be described.

At S10, data storage apparatus 12 is initiated.

At S12, every time data storage apparatus 12, it determines whether if awrite pointer of a last page of the user data stored in cache memorymirror 22 is larger than a flush pointer. Each page of the user dataincludes metadata. According to the present invention, the metadata areconfigured to include the write pointer and the flush pointer. Datastorage apparatus 12 finds the last page of the user data written incache memory mirror 22, and determines whether if a physical allocationaddress (“PAA”) of the write pointer of the metadata is larger than thatof the flush pointer. The process goes to S14 if the write pointer islarger than the flush pointer, or goes to S16 if otherwise.

At S14, a page that follows the page represented by the flush pointer toa last page are transferred into cache memory module 14, and givenlogical allocation addresses (“LAA”). For example, the write pointer is7, and the flush pointer is 4. That the write pointer is 7 means pages 1to 7 of the user data are stored in cache memory mirror 22 temporarily.That the flush pointer is 4 means pages 1 to 4 of the user data havebeen flushed into user data storage zone 24 from cache memory 20. Pages5 to 7 of the user data have not been stored in user data storage zone24. Hence, pages 5 to 7 of the user data are transferred into cachememory module 14 from cache memory mirror 22. Then, cache memory module14 transfers pages 5 to 7 of the user data into cache memory 20 via aninternal path.

At S16, it is determined whether if host 10 gives a write command thatincludes user data. The process goes to S18 if host 10 gives a writecommand, or goes to S36 if otherwise.

At S18, host 10 transfers the user data into cache memory module 14.

At S20, it is determined whether if the size of the space for storage ofdata left in cache memory mirror 22 is smaller than the size of thewrite command. The process goes to S22 if the size of the space forstorage of data left in cache memory mirror 22 is smaller than the sizeof the write command, or goes to S26 if otherwise.

At S22, dirty data are flushed into user data storage zone 24 from cachememory 20. The dirty data are some of the user data that have not beenflushed into user data storage zone 24 from cache memory 20.

At S24, another portion of NAND flash memory module 18 is selected andused as cache memory 20.

At S26, the user data are written into cache memory mirror 22 from cachememory module 14.

At S28, data storage apparatus 12 tells host 10 that the write commandhas been executed.

At S30, it is determined whether if the amount of bytes of the dirtydata stored in cache memory 20 reaches a predetermined threshold. Theprocess goes to S32 if the amount of bytes of the dirty data stored incache memory 20 reaches a predetermined threshold, or goes to S36 ifotherwise.

At S32, the dirty data are flushed into user data storage zone 24 fromcache memory module 14 via flash translation layer 16.

At S34, the flush pointer is updated.

At S36, the process is finished. The process will be repeated if host 10gives another write command.

The user data are written into user data storage zone 24 in thewrite-back mode. MLC or TLC, which is inexpensive, can be used as userdata storage zone 24 due to the use of the write-back mode. The userdata are written into user data storage zone 24 from cache memory module14 in the write-back mode if no power failure occurs.

The user data are written into cache memory mirror 22 in thewrite-through mode. However, the writing of the user data into cachememory mirror 22 in the write-through mode is not slow because the cachememory mirror 22 is operated in the SLC mode and the writing of datainto an SLC is inherently fast. Cache memory mirror 22 is a temporarystorage zone. The user data will not be read from cache memory mirror 22if no power failure occurs during the writing of the user data. The userdata will not be read from cache memory mirror 22 if no power failureoccurs during the writing of the user data.

Data storage apparatus 12 includes several advantageous features.Firstly, solid-state drive writes the user data into cache memory mirror22 according to each write command from host 10, and cache memory mirror22 is part of NAND flash memory module 18.

Secondly, cache memory mirror 22 is programmed to operate in the SLCmode.

Thirdly, data storage apparatus 12 writes the flush pointer in a sparearea of each page of the user data stored in cache memory mirror 22. Theflush pointer represents the last PAA of the user data in cache memorymirror 22 before they are flushed.

Fourthly, the sequence by which the dirty data are flushed into userdata storage zone 24 from cache memory 20 is called “flush sequence.”The sequence by which the same data are written into cache memory mirror22 is called “write sequence.” The flush sequence must be identical tothe write sequence.

Fifthly, data storage apparatus 12 updates the flush pointer every timeit flushes the dirty data into user data storage zone 24 from cachememory module 14.

Sixthly, data storage apparatus 12 determines whether if the same userdata as those stored in the cache memory mirror 22 have been flushedinto user data storage zone 24 every time data storage apparatus 12 isinitiated. Data storage apparatus 12 has to rebuild those user data thathave been lost from cache memory 20 and not flushed into user datastorage zone 24.

Seventhly, cache memory 20 sets the PAA for those user data.

The present invention has been described via the illustration of thepreferred embodiment. Those skilled in the art can derive variationsfrom the preferred embodiment without departing from the scope of thepresent invention. Therefore, the preferred embodiment shall not limitthe scope of the present invention defined in the claims.

1. A data storage apparatus comprising: a NAND flash memory module (18)configured to comprise a cache memory mirror (22) and a user datastorage zone (24); and a cache memory module (14) electrically connectedto the cache memory mirror (22) via a first path and electricallyconnected to the user data storage zone (24) via a second path, whereinthe cache memory module (14) receives a write command that comprisesuser data from a host (10), writes a copy of the user data into the userdata storage zone (24) in a write-back mode, and writes another copy ofthe user data cache memory mirror (22) in a write-through mode, whereinif some of the user data are lost from the cache memory module (14)before all of them are written into the user data storage zone (24), theuser data written in the cache memory mirror (22) are copied and writteninto the cache memory module (14) when the data storage apparatus (12)is initiated again.
 2. The data storage apparatus according to claim 1,wherein the cache memory module (14) comprises a cache memory (20) forstoring the user data, and flushing the user data into the user datastorage zone (24) when the amount of the user data reaches apredetermined value.
 3. The data storage apparatus according to claim 2,further comprising a flash translation layer (16) for electricallyconnecting the cache memory (20) to the user data storage zone (24). 4.A data storage method comprising the steps of: providing a data storageapparatus (12) with a cache memory module (14) and a NAND flash memorymodule (18), wherein the cache memory module (14) comprises a cachememory (20); selecting a portion of the NAND flash memory module (18) asa cache memory mirror (22); selecting another portion of the NAND flashmemory module (18) as a user data storage zone (24); transferring awrite command that comprises user data into the cache memory module (14)from a host (10); writing a copy of the user data into the user datastorage zone (24) from the cache memory module (14) in a write-backmode; writing another copy of the user data into the cache memory mirror(22) from the cache memory module (14) in a write-through mode;determining whether if any of the user data are lost from the cachememory module (14) before all of them are written into the user datastorage zone (24); and copying the user data stored in the cache memorymirror (22) and writing them into the cache memory module (14) when thedata storage apparatus (12) is initiated again if some of the user dataare lost from the cache memory module (14) before all of them arewritten into the user data storage zone (24).
 5. The data storage methodaccording to claim 4, wherein the step of determining whether if any ofthe user data are lost from the cache memory module (14) before all ofthem are written into the user data storage zone (24) comprises thesteps of: setting a write pointer for every page of the user data storedin the cache memory mirror (22); setting a flush pointer for every pageof the user data stored in the cache memory mirror (22); determiningwhether if the write pointer is larger than the flush pointer; andupdating the flush pointer every time the user data are written into theuser data storage zone (24) from the cache memory module (14).
 6. Thedata storage method according to claim 4, wherein the step of copyingthe user data stored in the cache memory mirror (22) and writing theminto the cache memory module (14) comprising the steps of: writing apage that follows the page represented by the flush pointer to a lastpage into the cache memory (20) from the cache memory mirror (22); andsetting logical allocation addresses for the user data.
 7. The datastorage method according to claim 4, wherein the step of transferring awrite command that comprises user data into the cache memory module (14)from a host (10) comprises the steps of: determining whether if the host(10) gives a write command; transferring the user data into the cachememory module (14) from host (10) if the host (10) gives a writecommand; and stopping the process if the host (10) does not give a writecommand.
 8. The data storage method according to claim 4, wherein thestep of writing another copy of the user data into the cache memorymirror (22) from the cache memory module (14) in a write-through modecomprises the steps of: determining whether if the size of space forstorage of data left in the cache memory mirror (22) is smaller thanthat of the write command; if the size of space for storage of data leftin the memory mirror (22) is smaller than that of the write command,executing the steps of: flushing the user data into the user datastorage zone (24) from the cache memory (20); and selecting anotherportion of the NAND flash memory module (18) as the cache memory mirror(22).
 9. The data storage method according to claim 4, wherein the stepof writing the user data into the cache memory mirror (22) from thecache memory module (14) further comprising the step of telling the host(10) that the user data have been written into the cache memory mirror(22) from the cache memory module (14).
 10. The data storage methodaccording to claim 5, wherein the step of writing the user data into theuser data storage zone (24) from the cache memory module (14) in thewrite-back mode comprising the steps of: determining whether if theamount of dirty data reaches a predetermined value; and flushing theuser data into the user data storage zone (24) from the cache memorymodule (14) and updating the flush pointer if the amount of the dirtydata reaches the predetermined value.